# !/usr/bin/env python
# -*- coding: utf-8 -*-

from pyspark.sql import SparkSession

# https://www.kaggle.com/datasets/timmofeyy/all-the-airport-across-the-world-dataset
if __name__ == '__main__':
    spark = SparkSession.builder.appName("pandas learn").master("local[*]").getOrCreate()
    data = [("Tom", 28), ("John", 21), ("Mike", 21), ("Sara", 25)]
    columns = ["name", "age"]
    df = spark.createDataFrame(data, columns)
    data = df.toPandas()
    print(data[['name', 'age']])
    d = data[['name']].describe()
    print(d)
    out = d.T.to_dict()
    print(out)
    print(d.to_dict())
    spark.stop()

